    var url = 'http://218.62.41.108:8020/',
        dataUrl = 'JLProductImgController.do?productTypes&area=220000',
        folderUrl = 'http://218.62.41.108:8020/JLProductImgController.do?productImg&areafolder=',
        imgUrl = 'http://10.172.13.57:8087/data/';
    AppleImgUrl='http://10.172.13.57:8087/';
    var allData = [],  //全部类型数据
        nowData = [],
        // typeData = [],
        smallIndex = 0, //当前小图索引
        imgsArr = [], //当前图片数
        nowGroup = 1, //当前第几组
        showNum = 7, //每组小图数量为8
        allGroup, //多少组
        timer1, //定时器1
        timer2, //定时器2
        type = '',
        name = '',
        third = '';
    YuBaoXiaoMaiTypeData=[	{"typePinYin":"ChouSuiQian","producttype":"抽穗前"}, {"typePinYin":"ChouSuiHou","producttype":"抽穗后"}, {"typePinYin":"ChuCang","producttype":"储藏"},
        {"typePinYin":"DongGuan","producttype":"冬灌"}, {"typePinYin":"LiangShai","producttype":"晾晒"}, {"typePinYin":"PenYao","producttype":"喷药"},
        {"typePinYin":"ShiFei","producttype":"施肥"}, {"typePinYin":"XiaoMaiBoZhong","producttype":"播种"}, {"typePinYin":"XiaoMaiShouHuo","producttype":"收获"}
    ];
    YuBaoYuMiTypeData=[{"typePinYin":"XiaYuMiBoZhong","producttype":"播种"}, {"typePinYin":"XiaYuMiShouHuo","producttype":"收获"}
    ];
    YuBaoYingTaoTypeData=[{"typePinYin":"XiuMianQi","producttype":"休眠期"}
    ];
    ZaiHaiXiaoMaiTypeData=[{"typePinYin":"LianYinYu","producttype":"连阴雨"}, {"typePinYin":"ShuangDong","producttype":"霜冻"}
    ];
    YuBaoChaYeTypeData=[{"typePinYin":"YueDongXiuMianQi","producttype":"越冬休眠期"}
    ];
    //苹果适宜性 灾害
    YuBaoPingGuoShengYuQiTypeData=[
        {"typePinYin":"dcggsyx","producttype":"冬春灌溉"}, {"typePinYin":"jdsyx","producttype":"解袋"},
        {"typePinYin":"nypssyx","producttype":"农药喷洒"},{"typePinYin":"tdsyx","producttype":"套袋"},
         {"typePinYin":"zssyx","producttype":"着色"}
    ];
    YuBaoPingGuoNongShiTypeData=[{"typePinYin":"cscsqsyx","producttype":"成熟采收期"}, {"typePinYin":"csqsyx","producttype":"抽梢期"}, {"typePinYin":"cstzqsyx","producttype":"春梢停长期"},
        {"typePinYin":"khsqsyx","producttype":"开花始期"},{"typePinYin":"lyqsyx","producttype":"落叶期"},
        {"typePinYin":"mhqsyx","producttype":"末花期"},{"typePinYin":"shqsyx","producttype":"盛花期"},
        {"typePinYin":"ybsqsyx","producttype":"叶变色期"},{"typePinYin":"ykfqsyx","producttype":"芽开放期"},{"typePinYin":"ypdqsyx","producttype":"芽膨大期"},
        {"typePinYin":"zyqsyx","producttype":"展叶期"}
    ];
    YuBaoPingGuoQiXiangZaiHaiTypeData=[{"typePinYin":"dfzh","producttype":"大风灾害"}, {"typePinYin":"yddh","producttype":"越冬冻害"}, {"typePinYin":"zcdwlh","producttype":"早春低温冻害"}
    ];
    imgData =["Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_072.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_096.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_120.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_144.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_168.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_192.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_216.png",
        "Province/610000/YuBao/XiaoMai/ChouSuiQian/20181228/Province_610000_YuBao_XiaoMai_ChouSuiQian_20181228_240.png",
    ];
    AppleImgData =["DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_24_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_48_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_72_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_96_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_120_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_144_htgy__qixiangzaihai_2_dfzh_ri.png",
        "DAP/shanxi/qixiangzaihai/2/dfzh/ri/2019010720_168_htgy__qixiangzaihai_2_dfzh_ri.png",
    ];


    // 全部数据
    function queryAllData(){
        $.ajax({
            url: url + dataUrl,
            type: 'GET',
            success: function(data){
                allData = JSON.parse(data);
                listAdd(allData);
            }
        });
    }

    // 获取三级数据
    function queryThirdList(id){
        $.ajax({
            url: url + thirdListUrl + id,
            type: 'GET',
            success: function(data){
                var data = JSON.parse(data);
                console.log(data);
                if(0 != data.length){
                    $('.dataShow').empty();
                    var html = '';
                    for(var i = 0; i < data.length; i++){
                        html += '<li pic-url="'+ data[i].productMainpic +'">'+ data[i].productName +'</li>';
                    }
                    html = '<ul class="second-level">'+ html +'</ul>';
                    $('.first-level > li.select').append(html);
                    $('.first-level > li.select').find('.second-level').animate({height: 'show'});
                    thirdLevelClick();
                    $('.first-level > li.select li:nth(0)').click();
                }else{
                    $('.dataShow').text('无具体产品数据');
                }
            }
        });
    }

    // 获取图片
    function queryFolder(folder){
        var types=localStorage.getItem("cropName").split(",");
        var data= [];
        if(types[1] == "nongshi" || types[1] == "shengyuqi" ){
            for(x=0;x<3;x++){
                var tempArr = AppleImgData[x].split('\/');
                if(folder=="cscsqsyx"){
                    tempArr[6]="2018091508"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_cscsqsyx_ri"+".png"
                }else if(folder=="csqsyx"){
                    tempArr[6]="2018042108"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_csqsyx_ri"+".png"
                }else if(folder=="cstzqsyx"){
                    tempArr[6]="2018051608"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_cstzqsyx_ri"+".png"
                }else if(folder=="dcggsyx"){
                    tempArr[6]="2018122008"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_dcggsyx_ri"+".png"
                }else if(folder=="jdsyx"){
                    tempArr[6]="2018032008"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_jdsyx_ri"+".png"
                }else if(folder=="khsqsyx"){
                    tempArr[6]="2018040808"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_khsqsyx_ri"+".png"
                }else if(folder=="lyqsyx"){
                    tempArr[6]="2018110108"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_lyqsyx_ri"+".png"
                }else if(folder=="mhqsyx"){
                    tempArr[6]="2018041708"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_mhqsyx_ri"+".png"
                }else if(folder=="nypssyx"){
                    tempArr[6]="2018062008"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_nypssyx_ri"+".png"
                }else if(folder=="shqsyx"){
                    tempArr[6]="2018041008"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_shqsyx_ri"+".png"
                }else if(folder=="tdsyx"){
                    tempArr[6]="2018032012"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_tdsyx_ri"+".png"
                }else if(folder=="ybsqsyx"){
                    tempArr[6]="2018102508"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_ybsqsyx_ri"+".png"
                }else if(folder=="ykfqsyx"){
                    tempArr[6]="2018040108"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_ykfqsyx_ri"+".png"
                }else if(folder=="ypdqsyx"){
                    tempArr[6]="2018032108"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_ypdqsyx_ri"+".png"
                }else if(folder=="zssyx"){
                    tempArr[6]="2018052008"+"_"+(x+2)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_zssyx_ri"+".png"
                }else if(folder=="zyqsyx"){
                    tempArr[6]="2018040208"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"shiyixing"+"_"+"2_zyqsyx_ri"+".png"
                }
                var imgPath=AppleImgUrl+"DAP/shanxi/shiyixing/2/"+folder+"/ri/"+ tempArr[6];
                data.push(imgPath);

            }
        }else if(types[1] == "qixiangzaihai"){
            for(x=0;x<7;x++){
                var tempArr = AppleImgData[x].split('\/');
                if(folder=="dfzh"){
                    tempArr[6]="2019010720"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"qixiangzaihai"+"_"+"2_dfzh_ri"+".png"
                }else if(folder=="yddh" || folder=="zcdwlh"){
                    tempArr[6]="2018122008"+"_"+(x+1)*24+"_"+"shanxi"+"__"+"qixiangzaihai"+"_"+"2_"+folder+"_ri"+".png"
                }
                var imgPath=AppleImgUrl+"DAP/shanxi/qixiangzaihai/2/"+folder+"/ri/"+ tempArr[6];
                data.push(imgPath);

            }
        }else{
            var cityType;
            // var areaCode = localStorage.getItem("areaCode");//获取 点击存储的code值
             var userinfo =null;
            if(localStorage.userInfo){
                userinfo =  JSON.parse(localStorage.userInfo);
            }
            var areaCode = userinfo.code;
            var types=localStorage.getItem("cropName").split(",");
            var selectType=types[0];
            var cropName=types[1];
            var cropType=folder;
            var time="20190114";
            if(areaCode==61 ){
                areaCode=610000;
                cityType="Province";
            }else if( areaCode.length==4){
                areaCode=areaCode+"00";
                cityType="City";
            }else if(areaCode.length==6){
                cityType="County";
            }

            for(x=0;x<7;x++){
                var tempArr = imgData[x].split('\/');
                tempArr[0]=cityType;
                tempArr[1]=areaCode;
                tempArr[2]=selectType;
                tempArr[3]=cropName;
                tempArr[4]=cropType;
                tempArr[5]=time;
                if(folder =="ChouSuiQian" || folder =="ChouSuiHou" ||  folder =="DongGuan"){
                    if(((x+3)*24)<100){
                        tempArr[6]=cityType+"_"+areaCode+"_"+selectType+"_"+cropName+"_"+cropType+"_"+time+"_0"+(x+3)*24+".png";
                    }else{
                        tempArr[6]=cityType+"_"+areaCode+"_"+selectType+"_"+cropName+"_"+cropType+"_"+time+"_"+(x+3)*24+".png";
                    }
                }else{
                    if(((x+1)*24)<100){
                        tempArr[6]=cityType+"_"+areaCode+"_"+selectType+"_"+cropName+"_"+cropType+"_"+time+"_0"+(x+1)*24+".png";
                    }else{
                        tempArr[6]=cityType+"_"+areaCode+"_"+selectType+"_"+cropName+"_"+cropType+"_"+time+"_"+(x+1)*24+".png";
                    }
                }


                var imgPath= imgUrl+tempArr[0]+"/"+tempArr[1]+"/"+ tempArr[2]+"/"+ tempArr[3]+ "/"+tempArr[4]+"/"+ tempArr[5]+"/"+ tempArr[6]
                data.push(imgPath);
            }
        }
        showImg(data,types[0]);
    }